//
//  FANPictureCell.m
//  Weibo - OC
//
//  Created by user on 16/4/23.
//  Copyright © 2016年 user. All rights reserved.
//

#import "FANPictureCell.h"

//#warning 宏定义一定要放到 导入头文件的 上面, 会影响编译

//define this constant if you want to use Masonry without the 'mas_' prefix

#define MAS_SHORTHAND

//define this constant if you want to enable auto-boxing for default syntax

#define MAS_SHORTHAND_GLOBALS

#import <Masonry/Masonry.h>
#import <UIImageView+WebCache.h>

@interface FANPictureCell ()

@property (nonatomic, strong) UIImageView *iconImageView;

@end

@implementation FANPictureCell

- (UIImageView *)iconImageView{
    
    if (!_iconImageView) {
        
        _iconImageView = [[UIImageView alloc] init];
        
        _iconImageView.contentMode = UIViewContentModeScaleAspectFill;
        
        _iconImageView.clipsToBounds = true;
        
    }
    return _iconImageView;
}

- (void)setImageString:(NSString *)imageString{
    
    _imageString = imageString;
    
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:imageString] placeholderImage:[UIImage imageNamed:@"timeline_image_placeholder"]];
}

- (instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        [self setupUI];
    }
    
    return self;
}

- (void)setupUI{
    
    [self.contentView addSubview:self.iconImageView];
 
    [self.iconImageView makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.trailing.leading.bottom.equalTo(self.contentView);
        
    }];
}

@end
